﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;

[Serializable]
public class Spell:IUsable, IMovable,IDescription, ICastable
{
    [SerializeField]
    private string name;

    [SerializeField]
    private GameObject spellPrefab;

    [SerializeField]
    private float dmg;

    [SerializeField]
    private float spd;

    [SerializeField]
    private float castTime;

    [SerializeField]
    private float cost;

    [SerializeField]
    private Sprite icon;

    [SerializeField]
    private Color barcol;

    public string MyTitle { get => name; }
    public GameObject SpellPrefab { get => spellPrefab; }
    public float Dmg { get => dmg; }
    public float Spd { get => spd; }
    public float Cost { get => cost; }
    public float MyCastTime { get => castTime; }
    public Sprite MyIcon { get => icon; }
    public Color MyBarColour { get => barcol; }

    //public string MyTitle => throw new NotImplementedException();

    //public float MyCastTime => throw new NotImplementedException();

    //public Sprite MyIcon => throw new NotImplementedException();

    //public Color MyBarColour => throw new NotImplementedException();

    public string Description()
    {
        return string.Format("<color=#fff>{0}</color>\nDeals {1} damage\nNeeds {2} to cast", MyTitle,Dmg,MyCastTime);
    }

    //  Sprite IUsable.Icon { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }

    public void use()
    {
        Player.MyInstance.castSpell(this);
    }
}
